<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>用户登录页面</title>
    <jsp:include page="../part/css/login.jsp" flush="true"/>
    <jsp:include page="../part/js/login.jsp" flush="true"/>
</head>
<body>


<form action="${pageContext.request.contextPath}/login" method="post" onsubmit="return handleSubmit()">

    <h2 class="title">欢迎来到学生管理登录页面</h2>
    <span class="form-item-label"> 用户名</span> <input class="form-item" type="text" name="username"
                                                        value="${login_result.user.username}"
                                                        placeholder="请输入用户名">
    <span></span>
    <c:if test="${!empty login_result.errors.username}">
        <span class="error-msg">${login_result.errors.username}</span>
    </c:if>
    <c:if test="${empty login_result.errors.username}">
        <span class="hidden">错误消息</span>
    </c:if>
    <span class="form-item-label"> 密码</span> <input class="form-item" type="password" name="password"
                                                      placeholder="请输入密码">
    <span></span>
    <c:if test="${!empty login_result.errors.password}">
        <span class="error-msg">${login_result.errors.password}</span>
    </c:if>
    <c:if test="${empty login_result.errors.password}">
        <span class="hidden">错误消息</span>
    </c:if>

    <img class="form-item" style="display: block;padding: 0"
         src="${pageContext.request.contextPath}/captcha"
         onclick="changeCaptcha(this,'${pageContext.request.contextPath}')">
    <input type="text" class="form-item" name="captchaCode" placeholder="请输入验证码">
    <span></span>
    <c:if test="${!empty login_result.errors.captchaCode}">
        <span class="error-msg">${login_result.errors.captchaCode}</span>
    </c:if>
    <c:if test="${empty login_result.errors.captchaCode}">
        <span class="hidden">错误消息</span>
    </c:if>
    <input class="form-btn" type="submit" value="登录">
    <input class="form-btn" type="reset" value="重置">
    <span></span>
    <span class="to-register">没有账号？<a href="${pageContext.request.contextPath}/register.html">去注册</a></span>

    <input type="hidden" name="repeat_code" value="${repeat_code}">
</form>

</body>
<script type="text/javascript">
    function handleSubmit() {
        layer.showLoading("正在登陆请稍后")
        return true;
    }
</script>
</html>
